package my.example.samplegridview;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

public class adminmenu extends Activity {
	
	Context _context;
	public static final String imageUrl = "http://www1.churrosroyale.com/opencart/main/image/";
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.adminmenu);
		
		_context = this.getBaseContext();
		
		Button syncButton = (Button)findViewById(R.id.adminmenuSync);
		syncButton.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				syncProcess.Sync(adminmenu.this);
				/*Vector<product> products = product.SelectProducts(_context);
				String image = "";
				String plainimagepath = "";
				int index = 0;
				for(int i = 0 ; i < products.size() ; i++){
					plainimagepath = products.get(i).getImage();
					if(plainimagepath.length() > 0){
						index = plainimagepath.lastIndexOf("/");
						image = plainimagepath.substring(index+1);
						imageHelper.downloadFromUrl(adminmenu.imageUrl + plainimagepath, image, _context);
					}
				}
				
				Vector<category> categories = category.SelectCategories(_context);
				for(int i = 0 ; i < categories.size() ; i++){
					plainimagepath = categories.get(i).getImage();
					if(plainimagepath.length() > 0){
						index = plainimagepath.lastIndexOf("/");
						image = plainimagepath.substring(index+1);
						imageHelper.downloadFromUrl(adminmenu.imageUrl + plainimagepath, image, _context);
					}
				}*/
			}		
		});
	}

}
